<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Set" %>
<%@ page import="javax.swing.text.html.HTMLDocument" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="Vo.Post" %>
<%@ page import="Vo.User" %><%--
  Created by IntelliJ IDEA.
  User: Cly
  Date: 2021-12-14
  Time: 15:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>首页</title>
    <script src="jquery.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="主页.css">
</head>
<body>
<%
    User user=(User) session.getAttribute("user");
    HashMap allpost=(HashMap) session.getAttribute("allpost");
%>

<div class="column left">
    <div class="yuan container">
        <h3>欢迎您登录论坛</h3>
        <div class="circle">
            <img src="<%=user.getPic()%>" id="img2" name="img2" height="50px" width="50px"/>
        </div>
        <p><%=user.getUsername()%></p>
        <div id="nav">
            <ul class="firstNav">
                <li>
                    <a href="postMessage.jsp">我要发帖</a>
                </li>
                <li>
                    <a href="change.jsp">修改密码</a>
                </li>
                <li>
                    <a href="login.jsp">注销账户</a>
                </li>
                <li>
                    <a href="home.jsp">返回主页</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div class="main container">
<table class="style-table">
    <thead>
    <tr>
        <td>标题</td>
        <td>作者</td>
        <td>发表时间</td>
        <td>点击量</td>s
        <td>查看</td>
    </tr>
    </thead>
    <%
//        Set set=null;
//        set= allpost.keySet();
        Iterator iterator=allpost.keySet().iterator();
        while (iterator.hasNext()){
            String Pid=(String) iterator.next();
            Post post=(Post) allpost.get(Pid);
    %>
    <tbody>
    <tr>
        <td><%=post.getTitle()%></td>
        <td><%=post.getUsername()%></td>
        <td><%=post.getCreatedtime()%></td>
        <td><%=post.getHits()%></td>
        <td><a href="post.jsp?Pid=<%=post.getPid()%>" text-aligan：center>查看</a> </td>
    </tr>
    <%}%>
    </tbody>
</table>
</div>
</body>
</html>
